package com.lg.concurrent.base;

/**
 * cpu时间片的分配是随机的
 * start 是异步的
 * run   不是
 */
public class StartAndRun {
    public static void main(String[] args) {

        RandomThread randomThread = new RandomThread();
        randomThread.start();
//        randomThread.run();
        for (int i = 0; i < 100; i++) {
            System.out.println("main-thread --> " + i);
        }
    }

    static class RandomThread extends Thread{

        @Override
        public void run() {
            for (int i = 0; i < 100; i++) {
                System.out.println("new-thread --> " + i);
            }
        }
    }
}
